export default {

  data() {
    return {
      inAnimation: true,
      inAnimation1: true,
      inAnimation2: true,
      inAnimation3: true,
      teacherMenuId: '',
      teacherchart1: null,
      teacherchart2: null,
      teacherchart3: null,
      teacherchart4: null,
      teacherchart5: null,
      charta: null,
      teacheroption1: {},
      teacheroption2: {},
      teacheroption3: {},
      teacheroption4: {},
      titlelabel: '专任教师',
      zcHeight: '350px',
      xbHeight: '350px',

      zrjss: {
        xq: 0,
        xx: 0,
        cz: 0,
        gz: 0,
        zz: 0,
        tj: 0
      },
    }
  },

  computed: {
    marginTop () {
      let m = '0'
      this.zcHeight = '350px'
      if ((this.curMenuId === 1 || this.curMenuId === 5 || this.curMenuId === 6) && this.page === 'teacher') {
        m = '120px'
        this.zcHeight = '550px'
        return m
      } else {
        return m
      }
    },
    xbmarginTop () {
      let m = '0'
      this.xbHeight = '350px'
      if (this.curMenuId === 6 && this.page === 'teacher') {
        m = '120px'
        this.xbHeight = '550px'
        return m
      } else {
        return m
      }
    },
  },

  methods: {
    initTea () {
      if (!this.teacherchart1) {
        this.teacherchart1 = window.echarts.init(this.$refs.chartteacher1)
        this.teacherchart2 = window.echarts.init(this.$refs.chartteacher2)
        this.teacherchart3 = window.echarts.init(this.$refs.chartteacher3)
        this.teacherchart4 = window.echarts.init(this.$refs.chartteacher4)
        this.teacherchart5 = window.echarts.init(this.$refs.chartteacher5)
        this.charta = window.echarts.init(this.$refs.chartteachera)
      }
      this.getJsData()
      this.setTeaOption()
    },
    getJsData () {
      let vm = this
      let getwayurl = window.$twApp.gateway
      if (this.baseurls.length > 0 && this.baseurls[0].indexOf('http:') > -1) {
        getwayurl = this.baseurls[0]
      }
      let url = getwayurl + '/tw-cloud-datatheme-server/themedata/dp_jzggk_zrjss'
      let quary = { 'conditions': [{ "fieldName": "jgid", "operator": "IN", "fieldValues": ["430100000000"], "prepender": "AND"}], 'fields': [], 'orderMethods': [] }
      let orderMethods = { 'field': 'tjnf', 'method': 'ASC' }
      quary.orderMethods.push(orderMethods)

      window.axios.post(url, quary).then(res => {
        if (res.data && res.data.pageInfo && res.data.pageInfo.list.length > 0) {
          let length = res.data.pageInfo.list.length
          res.data.pageInfo.list.forEach((item, index) => {
            if (index === length - 1) {
              vm.zrjss = {
                xq: item.yey_zrjs,
                xx: item.xx_zrjs,
                cz: item.cz_zrjs,
                gz: item.gz_zrjs,
                zz: item.zz_zrjs,
                tj: item.tsjy_zrjs
              }
            }
          })
        }
      }).catch(err => {
        console.error(err)
      })
    },
    getYeyData () {
      let vm = this
      let getwayurl = window.$twApp.gateway
      if (this.baseurls.length > 0 && this.baseurls[0].indexOf('http:') > -1) {
        getwayurl = this.baseurls[0]
      }
      let url = getwayurl + '/tw-cloud-datatheme-server/themedata/dp_jzggk_zrjs_yey'
      // let quary = { 'orderMethods': [] }
      let quary = { 'conditions': [{ "fieldName": "jgid", "operator": "IN", "fieldValues": ["430100000000"], "prepender": "AND"}], 'fields': [], 'orderMethods': [] }
      // {field:字段名，method：asc或者desc}
      // let timeSectionValue = { 'fieldName': 'jyjd', 'fieldValues': [queryData], 'operator': 'IN', 'prepender': 'AND' }
      let orderMethods = { 'field': 'tjnf', 'method': 'ASC' }
      quary.orderMethods.push(orderMethods)

      let zcdata = []
      let zclegend = ['数据', '长沙', '全省', '全国']

      let xldata = []

      let xbdata = []
      let xblegend = ['数据', '女教师', '男教师']
      let ssbdata = {ssb: 0, qg_ssb: 0, yg_ssb: 0, mg_ssb: 0}

      let nldata = []
      let nl1 = {}
      let nl2 = {}
      let nl3 = {}
      window.axios.post(url, quary).then(res => {
        if (res.data && res.data.pageInfo && res.data.pageInfo.list.length > 0) {
          let length = res.data.pageInfo.list.length
          res.data.pageInfo.list.forEach((item, index) => {
            if (index === 0) {
              zcdata.push(zclegend)
              xbdata.push(xblegend)

              nl1 = {
                value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                name: '长沙' + item.tjnf
              }
            }
            let zc = [item.tjnf, item.zyjszw_zj + item.zyjszw_gj, item.qs_zyjszw_zjjys, item.qg_zyjszw_zjjys]

            zcdata.push(zc)

            if (item.tjnf === (item.tjnf_wg + '')) {
              nl3 = {
                value: [item.yg_nl_30syx || 0, item.yg_nl_30_39 || 0, item.yg_nl_40_49 || 0, item.yg_nl_50_59 || 0, item.yg_nl_60jyx || 0],
                name: '英国' + item.tjnf
              }
            }

            if (index === length - 1) {
              xldata = [item.xl_bkby + item.xl_yjsby, item.qs_xl_bkjysby, item.qg_xl_bkjysby, item.mg_xl_bkjyx, item.yg_xl_bkjys]

              let xb = ['长沙', -1 * (item.zrjs_xb_nv), item.zrjs_xb_nan]
              let xbqg = ['全国', -1 * (item.qg_zrjs_xb_nv), item.qg_zrjs_xb_nan]
              let xbmg = ['美国', -1 * (item.mg_zrjs_xb_nv), item.mg_zrjs_xb_nan]
              let xbyg = ['英国', -1 * (item.yg_zrjs_xb_nv), item.yg_zrjs_xb_nan]
              xbdata.push(xbyg)
              xbdata.push(xbmg)
              xbdata.push(xbqg)
              xbdata.push(xb)

              let ssb = item.ssb || 0
              let qg_ssb = item.qg_ssb || 0
              let yg_ssb = item.yg_ssb || 0
              let mg_ssb = item.mg_ssb || 0
              ssbdata = { ssb: ssb, qg_ssb: qg_ssb, yg_ssb: yg_ssb, mg_ssb: mg_ssb }

              nl2 = {
                value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                name: '长沙' + item.tjnf
              }

              if (!nl3) {
                nl3 = {
                  value: [0, 0, 0, 0, 0],
                  name: '英国2017'
                }
              }
              if (!nl2) {
                nl2 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2015'
                }
              }
              if (!nl1) {
                nl13 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2019'
                }
              }
              nldata.push(nl1)
              nldata.push(nl2)
              nldata.push(nl3)
            }
          })
        }

        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
      }).catch(err => {
        console.error(err)
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
      })
    },
    getXxData () {
      let vm = this
      let getwayurl = window.$twApp.gateway
      if (this.baseurls.length > 0 && this.baseurls[0].indexOf('http:') > -1) {
        getwayurl = this.baseurls[0]
      }
      let url = getwayurl + '/tw-cloud-datatheme-server/themedata/dp_jzggk_zrjs_xx'
      let quary = { 'conditions': [{ "fieldName": "jgid", "operator": "IN", "fieldValues": ["430100000000"], "prepender": "AND"}], 'fields': [], 'orderMethods': [] }
      let orderMethods = { 'field': 'tjnf', 'method': 'ASC' }
      quary.orderMethods.push(orderMethods)

      let zcdata = []
      let zclegend = ['数据', '长沙', '全省', '全国']

      let xldata = []

      let xbdata = []
      let xblegend = ['数据', '女教师', '男教师']
      let ssbdata = {ssb: 0, qg_ssb: 0, yg_ssb: 0, mg_ssb: 0}

      let nldata = []
      let nl1 = {}
      let nl2 = {}
      let nl3 = {}

      let bsbdata = []
      window.axios.post(url, quary).then(res => {
        if (res.data && res.data.pageInfo && res.data.pageInfo.list.length > 0) {
          let length = res.data.pageInfo.list.length
          res.data.pageInfo.list.forEach((item, index) => {
            if (index === 0) {
              zcdata.push(zclegend)
              xbdata.push(xblegend)

              nl1 = {
                value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                name: '长沙' + item.tjnf
              }
            }
            let zc = [item.tjnf, item.zyjszw_zj + item.zyjszw_gj, item.qs_zyjszw_zjjys, item.qg_zyjszw_zjjys]

            zcdata.push(zc)

            if (item.tjnf === (item.tjnf_wg + '')) {
              nl3 = {
                value: [item.yg_nl_30syx || 0, item.yg_nl_30_39 || 0, item.yg_nl_40_49 || 0, item.yg_nl_50_59 || 0, item.yg_nl_60jyx || 0],
                name: '英国' + item.tjnf
              }
            }

            if (index === length - 1) {
              xldata = [item.xl_bkby + item.xl_yjsby, item.qs_xl_bkjysby, item.qg_xl_bkjysby, item.mg_xl_bkjyx, item.yg_xl_bkjys]

              let xb = ['长沙', -1 * (item.zrjs_xb_nv), item.zrjs_xb_nan]
              let xbqg = ['全国', -1 * (item.qg_zrjs_xb_nv), item.qg_zrjs_xb_nan]
              let xbmg = ['美国', -1 * (item.mg_zrjs_xb_nv), item.mg_zrjs_xb_nan]
              let xbyg = ['英国', -1 * (item.yg_zrjs_xb_nv), item.yg_zrjs_xb_nan]
              xbdata.push(xbyg)
              xbdata.push(xbmg)
              xbdata.push(xbqg)
              xbdata.push(xb)

              let ssb = item.ssb || 0
              let qg_ssb = item.qg_ssb || 0
              let yg_ssb = item.yg_ssb || 0
              let mg_ssb = item.mg_ssb || 0
              ssbdata = { ssb: ssb, qg_ssb: qg_ssb, yg_ssb: yg_ssb, mg_ssb: mg_ssb }

              nl2 = {
                value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                name: '长沙' + item.tjnf
              }

              if (!nl3) {
                nl3 = {
                  value: [0, 0, 0, 0, 0],
                  name: '英国2017'
                }
              }
              if (!nl2) {
                nl2 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2015'
                }
              }
              if (!nl1) {
                nl13 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2019'
                }
              }
              nldata.push(nl1)
              nldata.push(nl2)
              nldata.push(nl3)

              let tmpbsb = []
              tmpbsb.push(['数据', '品德与生活', '语文', '数学', '英语', '体育', '科学', '艺术', '音乐', '美术', '信息技术', '劳动与技术'])
              tmpbsb.push(['长沙', item.bsb_pdysh, item.bsb_yw, item.bsb_sx, item.bsb_wy_yy, item.bsb_ty, item.bsb_kx, item.bsb_ys, item.bsb_yy, item.bsb_ms, item.bsb_xxjs, item.bsb_ldyjs])

              tmpbsb.push(['全国', item.qg_bsb_pdysh, item.qg_bsb_yw, item.qg_bsb_sx, item.qg_bsb_wy_yy, item.qg_bsb_ty, item.qg_bsb_kx, item.qg_bsb_ys, item.qg_bsb_yy, item.qg_bsb_ms, item.qg_bsb_xxjs, item.qg_bsb_ldyjs])

              bsbdata = tmpbsb[0].map(function(col, i) {
            　　return tmpbsb.map(function(row) {
            　　　return row[i]
            　　})
              })
            }
          })
        }
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
        this.getBsbData(bsbdata)
      }).catch(err => {
        console.error(err)
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
        this.getBsbData(bsbdata)
      })
    },
    getCzData () {
      let vm = this
      let getwayurl = window.$twApp.gateway
      if (this.baseurls.length > 0 && this.baseurls[0].indexOf('http:') > -1) {
        getwayurl = this.baseurls[0]
      }
      let url = getwayurl + '/tw-cloud-datatheme-server/themedata/dp_jzggk_zrjs_cz'
      let quary = { 'conditions': [{ "fieldName": "jgid", "operator": "IN", "fieldValues": ["430100000000"], "prepender": "AND"}], 'fields': [], 'orderMethods': [] }
      let orderMethods = { 'field': 'tjnf', 'method': 'ASC' }
      quary.orderMethods.push(orderMethods)

      let zcdata = []
      let zclegend = ['数据', '长沙', '全省', '全国']

      let xldata = []

      let xbdata = []
      let xblegend = ['数据', '女教师', '男教师']
      let ssbdata = {ssb: 0, qg_ssb: 0, yg_ssb: 0, mg_ssb: 0}

      let nldata = []
      let nl1 = {}
      let nl2 = {}
      let nl3 = {}

      let bsbdata = []
      window.axios.post(url, quary).then(res => {
        if (res.data && res.data.pageInfo && res.data.pageInfo.list.length > 0) {
          let length = res.data.pageInfo.list.length
          res.data.pageInfo.list.forEach((item, index) => {
            if (index === 0) {
              zcdata.push(zclegend)
              xbdata.push(xblegend)
              if (item.nl_30syx) {
                nl1 = {
                  value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                  name: '长沙' + item.tjnf
                }
              }
            } else if (index < length - 1 && nl1.length === 0) {
              if (item.nl_30syx) {
                nl1 = {
                  value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                  name: '长沙' + item.tjnf
                }
              }
            }
            let zc = [item.tjnf, item.zyjszw_zj + item.zyjszw_gj, item.qs_zyjszw_zjjys, item.qg_zyjszw_zjjys]

            zcdata.push(zc)

            if (item.tjnf === (item.tjnf_wg + '')) {
              nl3 = {
                value: [item.yg_nl_30syx || 0, item.yg_nl_30_39 || 0, item.yg_nl_40_49 || 0, item.yg_nl_50_59 || 0, item.yg_nl_60jyx || 0],
                name: '英国' + item.tjnf
              }
            }

            if (index === length - 1) {
              xldata = [item.xl_bkby + item.xl_yjsby, item.qs_xl_bkjysby, item.qg_xl_bkjysby, item.mg_xl_bkjyx, item.yg_xl_bkjys]

              let xb = ['长沙', -1 * (item.zrjs_xb_nv), item.zrjs_xb_nan]
              let xbqg = ['全国', -1 * (item.qg_zrjs_xb_nv), item.qg_zrjs_xb_nan]
              let xbmg = ['美国', -1 * (item.mg_zrjs_xb_nv), item.mg_zrjs_xb_nan]
              let xbyg = ['英国', -1 * (item.yg_zrjs_xb_nv), item.yg_zrjs_xb_nan]
              xbdata.push(xbyg)
              xbdata.push(xbmg)
              xbdata.push(xbqg)
              xbdata.push(xb)

              let ssb = item.ssb || 0
              let qg_ssb = item.qg_ssb || 0
              let yg_ssb = item.yg_ssb || 0
              let mg_ssb = item.mg_ssb || 0
              ssbdata = { ssb: ssb, qg_ssb: qg_ssb, yg_ssb: yg_ssb, mg_ssb: mg_ssb }

              nl2 = {
                value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                name: '长沙' + item.tjnf
              }

              if (!nl3) {
                nl3 = {
                  value: [0, 0, 0, 0, 0],
                  name: '英国2017'
                }
              }
              if (!nl2) {
                nl2 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2015'
                }
              }
              if (!nl1) {
                nl13 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2019'
                }
              }
              nldata.push(nl1)
              nldata.push(nl2)
              nldata.push(nl3)

              let tmpbsb = []
              tmpbsb.push(['数据', '思想品德', '语文', '数学', '英语', '科学', '物理', '化学', '生物', '历史与社会', '地理', '历史', '体育与健康', '艺术', '音乐', '美术', '信息技术', '劳动与技术'])
              tmpbsb.push(['长沙', item.bsb_sxpd, item.bsb_yw, item.bsb_sx, item.bsb_wy_yy, item.bsb_kx, item.bsb_wl, item.bsb_hx, item.bsb_sw, item.bsb_lsysh, item.bsb_dl, item.bsb_ls, item.bsb_tyyjk, item.bsb_ys, item.bsb_yy, item.bsb_ms, item.bsb_xxjs, item.bsb_ldyjs])

              tmpbsb.push(['全国', item.qg_bsb_sxpd, item.qg_bsb_yw, item.qg_bsb_sx, item.qg_bsb_wy_yy, item.qg_bsb_kx, item.qg_bsb_wl, item.qg_bsb_hx, item.qg_bsb_sw, item.qg_bsb_lsysh, item.qg_bsb_dl, item.qg_bsb_ls, item.qg_bsb_tyyjk, item.qg_bsb_ys, item.qg_bsb_yy, item.qg_bsb_ms, item.qg_bsb_xxjs, item.qg_bsb_ldyjs])

              bsbdata = tmpbsb[0].map(function(col, i) {
            　　return tmpbsb.map(function(row) {
            　　　return row[i]
            　　})
              })
            }
          })
        }
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
        this.getBsbData(bsbdata)
      }).catch(err => {
        console.error(err)
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
        this.getBsbData(bsbdata)
      })
    },
    getGzData () {
      let vm = this
      let getwayurl = window.$twApp.gateway
      if (this.baseurls.length > 0 && this.baseurls[0].indexOf('http:') > -1) {
        getwayurl = this.baseurls[0]
      }
      let url = getwayurl + '/tw-cloud-datatheme-server/themedata/dp_jzggk_zrjs_gz'
      let quary = { 'conditions': [{ "fieldName": "jgid", "operator": "IN", "fieldValues": ["430100000000"], "prepender": "AND"}], 'fields': [], 'orderMethods': [] }
      let orderMethods = { 'field': 'tjnf', 'method': 'ASC' }
      quary.orderMethods.push(orderMethods)

      let zcdata = []
      let zclegend = ['数据', '长沙', '全省', '全国']

      let xldata = []

      let xbdata = []
      let xblegend = ['数据', '女教师', '男教师']
      let ssbdata = {ssb: 0, qg_ssb: 0, yg_ssb: 0, mg_ssb: 0}

      let nldata = []
      let nl1 = {}
      let nl2 = {}
      let nl3 = {}

      let bsbdata = []
      window.axios.post(url, quary).then(res => {
        if (res.data && res.data.pageInfo && res.data.pageInfo.list.length > 0) {
          let length = res.data.pageInfo.list.length
          res.data.pageInfo.list.forEach((item, index) => {
            if (index === 0) {
              zcdata.push(zclegend)
              xbdata.push(xblegend)

              if (item.nl_30syx) {
                nl1 = {
                  value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                  name: '长沙' + item.tjnf
                }
              }
            } else if (index < length - 1 && nl1.length === 0) {
              if (item.nl_30syx) {
                nl1 = {
                  value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                  name: '长沙' + item.tjnf
                }
              }
            }
            let zc = [item.tjnf, item.zyjszw_zj + item.zyjszw_gj, item.qs_zyjszw_zjjys, item.qg_zyjszw_zjjys]
            zcdata.push(zc)

            if (item.tjnf === (item.tjnf_wg + '')) {
              nl3 = {
                value: [item.yg_nl_30syx || 0, item.yg_nl_30_39 || 0, item.yg_nl_40_49 || 0, item.yg_nl_50_59 || 0, item.yg_nl_60jyx || 0],
                name: '英国' + item.tjnf
              }
            }

            if (index === length - 1) {
              xldata = [item.xl_bkby + item.xl_yjsby, item.qs_xl_bkjysby, item.qg_xl_bkjysby, item.mg_xl_bkjyx, item.yg_xl_bkjys]

              let xb = ['长沙', -1 * (item.zrjs_xb_nv), item.zrjs_xb_nan]
              let xbqg = ['全国', -1 * (item.qg_zrjs_xb_nv), item.qg_zrjs_xb_nan]
              let xbmg = ['美国', -1 * (item.mg_zrjs_xb_nv), item.mg_zrjs_xb_nan]
              let xbyg = ['英国', -1 * (item.yg_zrjs_xb_nv), item.yg_zrjs_xb_nan]
              xbdata.push(xbyg)
              xbdata.push(xbmg)
              xbdata.push(xbqg)
              xbdata.push(xb)

              let ssb = item.ssb || 0
              let qg_ssb = item.qg_ssb || 0
              let yg_ssb = item.yg_ssb || 0
              let mg_ssb = item.mg_ssb || 0
              ssbdata = { ssb: ssb, qg_ssb: qg_ssb, yg_ssb: yg_ssb, mg_ssb: mg_ssb }

              nl2 = {
                value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                name: '长沙' + item.tjnf
              }
              if (!nl3) {
                nl3 = {
                  value: [0, 0, 0, 0, 0],
                  name: '英国2017'
                }
              }
              if (!nl2) {
                nl2 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2015'
                }
              }
              if (!nl1) {
                nl13 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2019'
                }
              }
              nldata.push(nl1)
              nldata.push(nl2)
              nldata.push(nl3)

              let tmpbsb = []
              tmpbsb.push(['数据', '思想品德', '语文', '数学', '英语', '物理', '化学', '生物', '地理', '历史', '信息技术', '通用技术', '体育与健康', '艺术', '音乐', '美术', '综合实践活动'])
              tmpbsb.push(['长沙', item.bsb_sxpd, item.bsb_yw, item.bsb_sx, item.bsb_wy_yy, item.bsb_wl, item.bsb_hx, item.bsb_sw, item.bsb_dl, item.bsb_ls, item.bsb_xxjs, item.bsb_tyjs, item.bsb_tyyjk, item.bsb_ys, item.bsb_yy, item.bsb_ms, item.bsb_zhsjhd])

              tmpbsb.push(['全国', item.qg_bsb_sxpd, item.qg_bsb_yw, item.qg_bsb_sx, item.qg_bsb_wy_yy, item.qg_bsb_wl, item.qg_bsb_hx, item.qg_bsb_sw, item.qg_bsb_dl, item.qg_bsb_ls, item.qg_bsb_xxjs, item.qg_bsb_tyjs, item.qg_bsb_tyyjk, item.qg_bsb_ys, item.qg_bsb_yy, item.qg_bsb_ms, item.qg_bsb_zhsjhd])

              bsbdata = tmpbsb[0].map(function(col, i) {
            　　return tmpbsb.map(function(row) {
            　　　return row[i]
            　　})
              })
            }
          })
        }
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
        this.getBsbData(bsbdata)
      }).catch(err => {
        console.error(err)
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
        this.getBsbData(bsbdata)
      })
    },
    getZzData () {
      let vm = this
      let getwayurl = window.$twApp.gateway
      if (this.baseurls.length > 0 && this.baseurls[0].indexOf('http:') > -1) {
        getwayurl = this.baseurls[0]
      }
      let url = getwayurl + '/tw-cloud-datatheme-server/themedata/dp_jzggk_zrjs_zdzyxx'
      let quary = { 'conditions': [{ "fieldName": "jgid", "operator": "IN", "fieldValues": ["430100000000"], "prepender": "AND"}], 'fields': [], 'orderMethods': [] }
      let orderMethods = { 'field': 'tjnf', 'method': 'ASC' }
      quary.orderMethods.push(orderMethods)

      let zcdata = []
      let zclegend = ['数据', '长沙', '全省', '全国']

      let xldata = []

      let xbdata = []
      let xblegend = ['数据', '女教师', '男教师']
      let ssbdata = {ssb: 0, qg_ssb: 0, yg_ssb: 0, mg_ssb: 0}

      let nldata = []
      let nl1 = {}
      let nl2 = {}
      let nl3 = {}

      window.axios.post(url, quary).then(res => {
        if (res.data && res.data.pageInfo && res.data.pageInfo.list.length > 0) {
          let length = res.data.pageInfo.list.length
          res.data.pageInfo.list.forEach((item, index) => {
            if (index === 0) {
              zcdata.push(zclegend)
              xbdata.push(xblegend)

              if (item.nl_30syx) {
                nl1 = {
                  value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                  name: '长沙' + item.tjnf
                }
              }
            } else if (index < length - 1 && nl1.length === 0) {
              if (item.nl_30syx) {
                nl1 = {
                  value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                  name: '长沙' + item.tjnf
                }
              }
            }
            let zc = [item.tjnf, item.zyjszw_zj + item.zyjszw_gj, item.qs_zyjszw_zjjys, item.qg_zyjszw_zjjys]
            zcdata.push(zc)

            if (item.tjnf === (item.tjnf_wg + '')) {
              nl3 = {
                value: [item.yg_nl_30syx || 0, item.yg_nl_30_39 || 0, item.yg_nl_40_49 || 0, item.yg_nl_50_59 || 0, item.yg_nl_60jyx || 0],
                name: '英国' + item.tjnf
              }
            }

            if (index === length - 1) {
              xldata = [item.xl_bkby + item.xl_yjsby, item.qs_xl_bkjysby, item.qg_xl_bkjysby, item.mg_xl_bkjyx, item.yg_xl_bkjys]

              let xb = ['长沙', -1 * (item.zrjs_xb_nv), item.zrjs_xb_nan]
              let xbqg = ['全国', -1 * (item.qg_zrjs_xb_nv), item.qg_zrjs_xb_nan]
              let xbmg = ['美国', -1 * (item.mg_zrjs_xb_nv), item.mg_zrjs_xb_nan]
              let xbyg = ['英国', -1 * (item.yg_zrjs_xb_nv), item.yg_zrjs_xb_nan]
              xbdata.push(xbyg)
              xbdata.push(xbmg)
              xbdata.push(xbqg)
              xbdata.push(xb)

              let ssb = item.ssb || 0
              let qg_ssb = item.qg_ssb || 0
              let yg_ssb = item.yg_ssb || 0
              let mg_ssb = item.mg_ssb || 0
              ssbdata = { ssb: ssb, qg_ssb: qg_ssb, yg_ssb: yg_ssb, mg_ssb: mg_ssb }

              nl2 = {
                value: [item.nl_30syx || 0, item.nl_30_39 || 0, item.nl_40_49 || 0, item.nl_50_59 || 0, item.nl_60jyx || 0],
                name: '长沙' + item.tjnf
              }

              if (!nl3) {
                nl3 = {
                  value: [0, 0, 0, 0, 0],
                  name: '英国2017'
                }
              }
              if (!nl2) {
                nl2 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2015'
                }
              }
              if (!nl1) {
                nl13 = {
                  value: [0, 0, 0, 0, 0],
                  name: '长沙2019'
                }
              }
              nldata.push(nl1)
              nldata.push(nl2)
              nldata.push(nl3)
            }
          })
        }
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
      }).catch(err => {
        console.error(err)
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.getNlData(nldata)
        this.setAOption(ssbdata)
      })
    },
    getTjData () {
      let vm = this
      let getwayurl = window.$twApp.gateway
      if (this.baseurls.length > 0 && this.baseurls[0].indexOf('http:') > -1) {
        getwayurl = this.baseurls[0]
      }
      let url = getwayurl + '/tw-cloud-datatheme-server/themedata/dp_jzggk_zrjs_tsjy'
      let quary = { 'conditions': [{ "fieldName": "jgid", "operator": "IN", "fieldValues": ["430100000000"], "prepender": "AND"}], 'fields': [], 'orderMethods': [] }
      let orderMethods = { 'field': 'tjnf', 'method': 'ASC' }
      quary.orderMethods.push(orderMethods)

      let zcdata = []
      let zclegend = ['数据', '长沙', '全省', '全国']

      let xldata = []

      let xbdata = []
      let xblegend = ['数据', '女教师', '男教师']
      let ssbdata = {ssb: 0, qg_ssb: 0, yg_ssb: 0, mg_ssb: 0}

      let ssb = 0
      window.axios.post(url, quary).then(res => {
        if (res.data && res.data.pageInfo && res.data.pageInfo.list.length > 0) {
          let length = res.data.pageInfo.list.length
          res.data.pageInfo.list.forEach((item, index) => {
            if (index === 0) {
              zcdata.push(zclegend)
              xbdata.push(xblegend)
            }
            let zc = [item.tjnf, item.zyjszw_zj + item.zyjszw_gj, item.qs_zyjszw_zjjys, item.qg_zyjszw_zjjys]
            zcdata.push(zc)

            if (ssb === 0) {
              ssb = item.ssb || 0
            }

            if (index === length - 1) {
              xldata = [item.xl_bkby + item.xl_yjsby, item.qs_xl_bkjysby, item.qg_xl_bkjysby, item.mg_xl_bkjyx, item.yg_xl_bkjys]

              let xb = ['长沙', -1 * (item.zrjs_xb_nv), item.zrjs_xb_nan]
              let xbqg = ['全国', -1 * (item.qg_zrjs_xb_nv), item.qg_zrjs_xb_nan]
              let xbmg = ['美国', -1 * (item.mg_zrjs_xb_nv), item.mg_zrjs_xb_nan]
              let xbyg = ['英国', -1 * (item.yg_zrjs_xb_nv), item.yg_zrjs_xb_nan]
              xbdata.push(xbyg)
              xbdata.push(xbmg)
              xbdata.push(xbqg)
              xbdata.push(xb)

              let qg_ssb = item.qg_ssb || 0
              let yg_ssb = item.yg_ssb || 0
              let mg_ssb = item.mg_ssb || 0
              ssbdata = { ssb: ssb, qg_ssb: qg_ssb, yg_ssb: yg_ssb, mg_ssb: mg_ssb }
            }
          })
        }
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.setAOption(ssbdata)
      }).catch(err => {
        console.error(err)
        this.getZcData(zcdata)
        this.getXlData(xldata)
        this.getXbData(xbdata)
        this.setAOption(ssbdata)
      })
    },

    setTeaOption () {
      if (this.curMenuId === 1) {
        this.getYeyData()
      } else if (this.curMenuId === 2) {
        this.getXxData()
      } else if (this.curMenuId === 3) {
        this.getCzData()
      } else if (this.curMenuId === 4) {
        this.getGzData()
      } else if (this.curMenuId === 5) {
        this.getZzData()
      } else if (this.curMenuId === 6) {
        this.getTjData()
      }
    },

    getZcData (indata) {
      let data = indata
      if (data.length === 0) {
        data = [
          ['数据', '长沙', '全省', '全国'],
          ['2015', 0, 0, 0],
          ['2016', 0, 0, 0],
          ['2017', 0, 0, 0],
          ['2018', 0, 0, 0],
          ['2019', 0, 0, 0],
        ]
      }

      let length = length = data[0].length

      this.teacheroption1 = JSON.parse(JSON.stringify(this.option))
      this.teacheroption1.color = ['#4c6aff', '#ffb686', '#a694ff', '#7e73ff', '#00e2fe', '#ffe666', '#1890ff', '#fb6c84']
      let a = this.teacheroption1.dataset
      a.source = data
      let b = this.teacheroption1.yAxis.axisLabel
      let c = this.teacheroption1.xAxis.axisLabel
      let d = this.teacheroption1.tooltip
      d.formatter = function (params) {
        let text = ''
        params.forEach((item, index) => {
          if (index === 0) {
            text += item.name + '<br>'
          } else {
            text += '<br>'
          }
          if (!item.value[item.componentIndex + 1] || item.value[item.componentIndex + 1] + '' === 'undefined' || item.value[item.componentIndex + 1] + '' === 'NAN') {
            text += item.marker + item.seriesName + '0%'
          } else {
            let v = Math.round(item.value[item.componentIndex + 1] * 100) / 100
            text += item.marker + item.seriesName + v + '%'
          }
        })
        return text
      }
      b.formatter = '{value}' + '%'
      c.formatter = '{value}' + '年'
      this.teacheroption1.series = []
      for (let i = 0; i < length - 1; i++) {
        this.teacheroption1.series.push({
          type: 'line',
          lineStyle: {
            width: 4
          },
          symbolSize: 10
        })
      }

      this.teacherchart1.setOption(this.teacheroption1, true)
      this.teacherchart1.resize()
    },
    getBsbData (indata) {
      let data = indata
      if (data.length === 0) {
        data = [
          ['数据', '长沙', '全国'],
          ['品德与生活', 0, 0],
          ['语文', 0, 0],
          ['数学', 0, 0],
          ['英语', 0, 0],
          ['体育', 0, 0],
          ['科学', 0, 0],
          ['艺术', 0, 0],
          ['音乐', 0, 0],
          ['美术', 0, 0],
          ['信息技术', 0, 0],
          ['劳动与技术', 0, 0],
        ]
      }
      let length = length = data[0].length

      this.teacheroption2 = JSON.parse(JSON.stringify(this.option))
      this.teacheroption2.color = ['#ffe666', '#7e73ff']
      let a = this.teacheroption2.dataset
      a.source = data
      let b = this.teacheroption2.xAxis.axisLabel
      b.interval = 0
      b.rotate = 45
      let c = this.teacheroption2.grid
      c.top = 35
      let d = this.teacheroption2.yAxis
      d.type = 'log'
      this.teacheroption2.series = []
      for (let i = 0; i < length - 1; i++) {
        if (i === 0) {
          this.teacheroption2.series.push({
            type: 'bar',
            barMaxWidth: 14
          })
        } else {
          this.teacheroption2.series.push({
            type: 'line',
            lineStyle: {
              width: 4
            },
            symbolSize: 10
          })
        }
      }

      this.teacherchart2.setOption(this.teacheroption2, true)
    },
    getXlData (indata) {
      let vm = this
      let xAxisData = []
      let seriesData1 = []

      let colors = ['#fea900', '#f5d55f', '#00aaff', '#06ffd7', '#0e4aed', '#6bc6ff', '#3f2fed', '#8a80ff', '#8712ed', '#ab80ff']
      if (indata.length === 0) {
        xAxisData = ['长沙', '全省', '全国']
        seriesData1 = [0, 0, 0]
      } else {
        let xData = ['长沙', '全省', '全国', '美国', '英国']
        indata.forEach((item, index) => {
          if (item) {
            let i = Math.round(item * 10) / 10
            seriesData1.push(i)
            xAxisData.push(xData[index])
          }
        })
      }

      let option = {
        xAxis: {
          data: xAxisData,
          axisTick: {
            show: false
          },
          axisLine: {
            show: false
          },
          axisLabel: {
            show: true,
            interval: 0,
            margin: 25,
            align: 'center',
            textStyle: {
              fontSize: 14,
              color: '#bad3ff',
            }
          },
          interval: 0
        },
        yAxis: {
          splitLine: {
            show: false
          },
          axisTick: {
            show: false
          },
          axisLine: {
            show: false
          },
          axisLabel: {
            show: false
          }
        },
        series: [{
          name: '柱顶部',
          type: 'pictorialBar',
          symbolSize: [20, 10],
          symbolOffset: [0, -5],
          z: 12,
          itemStyle: {
            normal: {
              color: function(params) {
                return colors[2 * params.dataIndex + 1]
              }
            }
          },
          label: {
            show: true,
            position: 'top',
            formatter: function (params) {
              return params.value + '%'
            },
            fontSize: 14
          },
          symbolPosition: 'end',
          data: seriesData1,
        }, {
          name: '柱底部',
          type: 'pictorialBar',
          symbolSize: [20, 10],
          symbolOffset: [0, 1],
          z: 12,
          itemStyle: {
            normal: {
              color: function (params) {
                return colors[2 * params.dataIndex]
              }
            }
          },
          data: seriesData1
        },
        {
          name: '第一圈',
          type: 'pictorialBar',
          symbolSize: [27, 6],
          symbolOffset: [0, 2],
          z: 11,
          itemStyle: {
            normal: {
              color: 'transparent',
              borderColor: colors[6],
              borderWidth: 2
            }
          },
          data: seriesData1
        },
        {
          name: '第二圈',
          type: 'pictorialBar',
          symbolSize: [32, 12],
          symbolOffset: [0, 5],
          z: 10,
          itemStyle: {
            normal: {
              color: 'transparent',
              borderColor: colors[5],
              borderType: 'dashed',
              borderWidth: 2
            }
          },
          data: seriesData1
        }, {
          type: 'bar',
          itemStyle: {
            normal: {
              color: function(params) {
                return new echarts.graphic.LinearGradient(
                  0, 0, 0, 1,
                  [{
                      offset: 1,
                      color: colors[2 * params.dataIndex]
                    },
                    {
                      offset: 0,
                      color: colors[2 * params.dataIndex + 1]
                    }
                  ]
                );
              },
              opacity: 0.8
            }
          },
          z: 16,
          silent: true,
          barWidth: 20,
          barGap: '-100%', // Make series be overlap
          data: seriesData1
        }]
      }

      this.teacherchart3.clear()
      this.teacherchart3.setOption(option, true)
      this.teacherchart3.resize()
    },
    getNlData (indata) {
      let data = indata
      let legenddata = []
      if (data.length === 0) {
        data = [
          ['数据', '长沙2019', '长沙2015', '英国2017'],
          ['24岁及以下', 0, 0, 0],
          ['25-29岁', 0, 0, 0],
          ['30-34岁', 0, 0, 0],
          ['34-39岁', 0, 0, 0],
          ['40-44岁', 0, 0, 0],
          ['45-49岁', 0, 0, 0],
          ['50-54岁', 0, 0, 0],
          ['55-59岁', 0, 0, 0],
          ['60岁及以上', 0, 0, 0]
        ]
      }
      let max = 1
      data.forEach(item => {
        legenddata.push(item.name)
        if (item && item.value) {
          item.value.forEach(itm => {
            if (max < itm) {
              max = itm
            }
          })
        }
      })
      max += 10

      let option = {
        color: this.colors,
        tooltip: {
          // formatter: function (params) {
          //   console.log(params)
          // }
        },
        legend: {
          itemHeight: 6,
          itemWidth: 12,
          icon: 'roundRect',
          textStyle: {
            color: '#bad3ff',
            fontSize: 14,
            padding: [3, 0, 0, 0]
          },
          data: legenddata
        },
        radar: {
          shape: 'circle',
          radius: '55%',
          name: {
            textStyle: {
              color: '#94aad4',
              // backgroundColor: '#999',
              borderRadius: 3,
              padding: [3, 5]
            }
          },
          splitArea: {
            show: false
          },
          splitLine: {
            lineStyle: {
              color: 'rgba(148,170,212,0.4)'
            }
          },
          axisLine: {
            lineStyle: {
              color: 'rgba(148,170,212,1)'
            }
          },
          indicator: [
            { name: '30岁及以下', max: max},
            { name: '30-39岁', max: max},
            { name: '40-49岁', max: max},
            { name: '50-59岁', max: max},
            { name: '60岁及以上', max: max},
          ]
        },
        series: [{
          name: '年龄分布',
          type: 'radar',
          areaStyle: {},
          data: data
        }]
      }
      this.teacherchart4.clear()

      this.teacherchart4.setOption(option, true)
      this.teacherchart4.resize()
    },
    getXbData (indata) {
      let data = indata
      if (data.length === 0) {
        data = [
          ['数据', '女教师', '男教师'],
          ['2015', 0, 0],
          ['2016', 0, 0],
          ['2017', 0, 0],
          ['2018', 0, 0],
          ['2019', 0, 0]
        ]
      }


      let option = {
        color: ['#ffe666', '#7e73ff'],
        legend: {
          itemHeight: 6,
          itemWidth: 12,
          icon: 'roundRect',
          textStyle: {
            color: '#bad3ff',
            fontSize: 14,
            padding: [3, 0, 0, 0]
          }
        },
        grid: {
          left: 45
        },
        tooltip: {
          trigger: 'axis',
          formatter: function (params) {
            let text = ''
            params.forEach((item, index) => {
              if (index === 0) {
                text += item.name + '<br>'
              } else {
                text += '<br>'
              }
              if (!item.value[item.componentIndex + 1] || item.value[item.componentIndex + 1] + '' === 'undefined' || item.value[item.componentIndex + 1] + '' === 'NAN') {
                text += item.marker + item.seriesName + '0%'
              } else if (item.value[item.componentIndex + 1] < 0) {
                text += item.marker + item.seriesName + (-1 * item.value[item.componentIndex + 1]) + '%'
              } else {
                text += item.marker + item.seriesName + item.value[item.componentIndex + 1] + '%'
              }
            })
            return text
          }
        },
        xAxis: {
          type: 'value',
          show: true,
          axisLine: {
            show: true,
            lineStyle: {
              color: 'rgba(148,170,212,1)'
            }
          },
          axisLabel: {
            show: true,
            formatter: function (params) {
              if (params >= 0) {
                return params + '%'
              } else {
                return (-1 * params) + '%'
              }
            },
            textStyle: {
              fontSize: 14,
              color: '#bad3ff'
            }
          },
          splitLine: {
            lineStyle: {
              color: [
                'rgba(148,170,212,0.4)'
              ]
            }
          }
        },
        yAxis: {
          type: 'category',
          show: true,
          boundaryGap: true,
          axisLine: {
            show: true,
            lineStyle: {
              color: 'rgba(148,170,212,1)'
            }
          },
          axisLabel: {
            show: true,
            formatter: '{value}',
            textStyle: {
              fontSize: 14,
              color: '#bad3ff'
            }
          },
          splitLine: {
            lineStyle: {
              color: [
                'rgba(148,170,212,0.4)'
              ]
            }
          }
        },
        dataset: {
          source: data
        },
        series: [
          { type: 'bar', barMaxWidth: 20, stack: 'bar' },
          { type: 'bar', barMaxWidth: 20, stack: 'bar' },
        ]
      }

      this.teacherchart5.setOption(option, true)
      this.teacherchart5.resize()
    }
  },

  mounted () {

  },

  beforeDestroy () {
    if (this.teacherchart1) {
      this.teacherchart1.dispose()
      this.teacherchart1 = null
      this.teacherchart2.dispose()
      this.teacherchart2 = null
      this.teacherchart3.dispose()
      this.teacherchart3 = null
      this.teacherchart4.dispose()
      this.teacherchart4 = null
      this.teacherchart5.dispose()
      this.teacherchart5 = null
      this.charta.dispose()
      this.charta = null
    }
  },

  watch: {

  }
}
